package com.netty.protobuf.client;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.ChannelFuture;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioSocketChannel;

/**
 * Created by Administrator on 2018/11/1/001.
 */
public class TestClient {

    public static void main(String[] args) {
        EventLoopGroup loopGroop = new NioEventLoopGroup();

        try {
            Bootstrap bootStrap = new Bootstrap();

            bootStrap.group(loopGroop).channel(NioSocketChannel.class);
            bootStrap.handler(new TestClientInitializer());

            ChannelFuture channelFuture = bootStrap.connect("localhost", 8899).sync();
            channelFuture.channel().closeFuture().sync();
            System.out.println("==");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            loopGroop.shutdownGracefully();
        }
    }
}
